<?php
    include 'base.php';

    // $pagenum = $_GET['pagenum'];
    // $pagesize = $_GET['pagesize'];
    $select = $_GET['select'];
    $select1 = $_GET['select1'];

    // $start = ($pagenum - 1) * $pagesize;

    $sql = "SELECT * FROM `boncake-first` WHERE `$select`=$select1 ";
    // WHERE `cat_two_id`=`111`

    // echo $sql;

    $res = $conn->query($sql);

    $arr = Array();

    while ($row = mysqli_fetch_assoc($res)) {
        array_push($arr, $row);
    }

    // echo json_encode($arr);

    /*
        {
            total: 960,
            code: 0,
            msg: '请求成功',
            data: [
                {},{}
            ]
        }
    */

    // $sql2 = "SELECT * FROM `boncake-first` ";

    // $res2 = $conn->query($sql2);

    // $n = 0;

    // while ($row2 = mysqli_fetch_assoc($res2)) {
    //     $n++;
    // }

    echo json_encode(Array(
        // 'total' => $n,
        'code' => 0,
        'msg' => '请求成功',
        'data' => $arr
    ));
?>